<template>
  <div class="index">
    <div class="indexList">
      <ul>
        <router-link class="iconA" tag="li" to="peopleList">会员人数：<span>{{numA}}</span></router-link>
        <router-link class="iconB" tag="li" to="prcList">商品数量：<span>{{numB}}</span></router-link>
        <router-link class="iconC" tag="li" to="orderList">订单总数量：<span>{{numC}}</span></router-link>
        <router-link class="iconD" tag="li" to="orderList">未处理订单：<span>{{numD}}</span></router-link>
      </ul>
    </div>
  </div>
</template>
<script>
import Vue from 'vue'
import Loading from '@/components/loading'
import axios from 'axios'
import { Get, Post ,Put } from '@/config/api'
export default {
  name: 'prcList',
  data() {
    return {
      numA:0,
      numB:0,
      numC:0,
      numD:0,
      numE:0
    }
  },
  mounted() {
    this.getA()
    this.getB()
    this.getC()
    this.getD()
    this.getE()
    setInterval(()=>{
      this.getA()
      this.getB()
      this.getC()
      this.getD()
      this.getE()
    },10000)
  },
  methods: {
    //获取数据
    async getA() {
      let reg=await Get('/users',this.$store.state.token)
      this.numA=reg.meta.pagination.total
    },
    async getB() {
      let reg=await Get('/goods',this.$store.state.token)
      this.numB=reg.meta.pagination.total
    },
    async getC() {
      let reg=await Get('/order/all',this.$store.state.token)
      this.numC=reg.meta.pagination.total
    },
    async getD() {
      let reg=await Get('/order/all?status=1',this.$store.state.token)
      this.numD=reg.meta.pagination.total
    },
    async getE() {
      let reg=await Get('/order/all?status=4',this.$store.state.token)
      this.numE=reg.meta.pagination.total
    }
  }
}

</script>
